/////////////////////////////////////////////////////////////////////////////
// Copyright(c) 2012-2015 sumscope All Rights Reserved
// Name:        message_process.h
// Purpose:     
// Author:      syy
// Modified by: 
// Created:     2022/6/15 13:27
// RCS-ID:      
// Licence:     
/////////////////////////////////////////////////////////////////////////////
#ifndef _MESSAGE_PROCESS_H_
#define _MESSAGE_PROCESS_H_

#include "message_sync.h"
#include <core/common_types.h>
#include <core/comdefs.h>
#include <qbprotocol/include/message_process_data.h>
#include <qbnet/include/network_service.h>

// {AFFF9A0B-DCE3-4557-BA5F-A63BA4E75A85}
DEFINE_GUID(IID_IMessageProcess,
            0xafff9a0b, 0xdce3, 0x4557, 0xba, 0x5f, 0xa6, 0x1b, 0x24, 0x37, 0x4a, 0x55);

#ifdef __cplusplus
extern "C" {
#endif

    DECLARE_INTERFACE(IMessageProcessorOnSubThread)
	{
        STDMETHOD_(void, OnResponse) (THIS_ int32_t msgtype, qb::ProcessMessage msp) PURE;
	};

    DECLARE_INTERFACE(IMessageProcessOnMainThreadObserver/*, IUnknown*/)
    {
        STDMETHOD_(void, OnMainThreadProcessData) (THIS_ int32_t msgtype, qb::ProcessMessage msp) PURE;
    };

    DECLARE_INTERFACE_(IMessageProcess, IUnknown)
	{
        STDMETHOD_(int32_t,Create) (THIS_ INetworkService* ins, IMessageSync* sync) PURE;
		STDMETHOD_(int32_t,Destory) (THIS_) PURE;
        STDMETHOD_(bool,RegisterMsgProcessorOnThread) (THIS_ int, IMessageProcessorOnSubThread* observer) PURE;
        STDMETHOD_(void,UnRegisterMsgProcessorOnThread) (THIS_ int, IMessageProcessorOnSubThread* observer) PURE;
        STDMETHOD_(int32_t,RegisterMessageProcessOnMainThreadObserver) (THIS_ IMessageProcessOnMainThreadObserver* observer) PURE;
        STDMETHOD_(int32_t,DeRegisterMessageProcessOnMainThreadObserver) (THIS_ IMessageProcessOnMainThreadObserver* observer) PURE;
        STDMETHOD_(int32_t,PushNetMessage)(THIS_ MESSAGE_SHARED_PTR msp) PURE;
        STDMETHOD_(int32_t,PushMainThreadMessage)(THIS_ char* buff, int32_t buflen) PURE;
	};

#ifdef __cplusplus
}
#endif

#endif // _MESSAGE_PROCESS_H_
